import java.awt.*;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.util.*;
import java.util.List;
import javax.swing.*;

import java.awt.event.*;

public class Container extends JPanel implements MouseListener, MouseMotionListener{
   private Image background;
   private JButton pindot,p2,p3,p4;
   private ImageIcon pic;
   private int goNext=0;
   private Photos prespag = new Photos();
   private Client proman = new Client();
   private Suppliers propag = new Suppliers();
   private Projects supag = new Projects();
   private String label="CLIENTS>>";
   
   public Container(){
	   HandleClass handler = new HandleClass();
	   HandleClass2 handler2 = new HandleClass2();
	   HandleClass3 handler3 = new HandleClass3();
	   //HandleClass4 handler4 = new HandleClass4();
	   setLayout(null);
	   pic = new ImageIcon(getClass().getResource("orang.png"));
	   pindot = new JButton("CLIENTS",pic);
	   pindot.setBounds(10,200,150,40);
	   pindot.addActionListener(handler);
	   
	   p2 = new JButton("SUPPLIERS",pic);
	   p2.setBounds(10,290,150,40);
	   p2.addActionListener(handler2);
	  
	   p3 = new JButton("PHOTOS",pic);
	   p3.setBounds(10,380,150,40);
	   p3.addActionListener(handler3);
	   
	 /*  p4 = new JButton("PROJECTS",pic);
	   p4.setBounds(10,470,150,40);
	   p4.addActionListener(handler4);*/
	   add(pindot); add(p2); add(p3); //add(p4);
	   
	   
	   proman.setBounds(170,172,846,508);
	   add(proman);
	   proman.setVisible(true);
	   
	   propag.setBounds(170,172,846,508);
	   add(propag);
	   propag.setVisible(false);
	   
	   prespag.setBounds(170,172,846,508);
	   add(prespag);
	   prespag.setVisible(false);
	   
	  /* supag.setBounds(170,172,846,508);
	   add(supag);
	   supag.setVisible(false);*/
	   //button_custom press = new button_custom();
	  // press.setPreferredSize(new Dimension(100,100));
	  // add(press);
	 loadImages();
	   
	   
   }
  
   
   
   public void loadImages(){
       try{
           background = new ImageIcon("pics/bg.png").getImage();
          
        } catch (Exception e) { }
       
       repaint();
   }
   
   public void paintComponent(Graphics g){
       super.paintComponent(g);
       Graphics2D g2d = (Graphics2D) g;
       setForeground(Color.red);
       setFont(new Font("Arial",Font.BOLD,25));
       g2d.drawImage(background, 0, 0, this);
       g2d.drawString(label,180,160);
       
   }
   
   public void setGoNext(int d){
	   goNext=1;
   }
   
   public int getGoNext(){
	  return goNext; 
   }
   
   public void Loopy(){
		while(goNext!=1)
			repaint();
		}
   
   private class HandleClass implements ActionListener{
		  public void actionPerformed(ActionEvent e){
			 // do something here
			  proman.setVisible(true);
			  propag.setVisible(false);
			  prespag.setVisible(false);
			  supag.setVisible(false);
			  label="CLIENTS>>";
			  Client proman = new Client();
			   proman.setBounds(170,172,846,508);
			   add(proman);
			 
			   repaint();
			 
		  }
		 
	   }
   
   private class HandleClass2 implements ActionListener{
		  public void actionPerformed(ActionEvent e){
			  proman.setVisible(false);
			  propag.setVisible(true);
			  prespag.setVisible(false);
			  supag.setVisible(false);
			  label="SUPPLIERS>>";
			 Suppliers propag = new Suppliers();
			   propag.setBounds(170,172,846,508);
			   add(propag);
			   repaint();
		  }
	   }
   
   private class HandleClass3 implements ActionListener{
		  public void actionPerformed(ActionEvent e){
			 // do something here 
			  proman.setVisible(false);
			  propag.setVisible(false);
			  prespag.setVisible(true);
			  supag.setVisible(false);
			  label="PHOTOS>>";
			  Photos prespag = new Photos();
			   prespag.setBounds(170,172,846,508);
			   add(prespag);
			   repaint();
		  }
	   }
   
 /*  private class HandleClass4 implements ActionListener{
		  public void actionPerformed(ActionEvent e){
			 // do something here 
			  proman.setVisible(false);
			  propag.setVisible(false);
			  prespag.setVisible(false);
			  supag.setVisible(true);
			  label="PROJECTS>>";
	           Projects supag = new Projects();
			   supag.setBounds(170,172,846,508);
			   add(supag);
			   repaint();
		  }
	   }*/
  
   
   public void mouseClicked(MouseEvent me) {
   	
   }
   public void mousePressed(MouseEvent me) {
       
   }
   public void mouseReleased(MouseEvent me) {
       
   }
   public void mouseDragged(MouseEvent me) {
       
   }
   public void mouseMoved(MouseEvent me) {
   
   }    
   public void mouseEntered(MouseEvent me) {
       
   }
   public void mouseExited(MouseEvent me) {
       
   }
  
}
